home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 3006 / 3006.xpi / chrome / dwhelper.jar / content / widgets.xml < prev    next >
Extensible Markup Language  |  2010-01-15  |  21KB  |  797 lines

  1. <?xml version="1.0"?>
  2. <!-- *****************************************************************************
  3.  *            Copyright (c) 2006-2009 Michel Gutierrez. All Rights Reserved.
  4.  ****************************************************************************** -->
  5. <!DOCTYPE bindings SYSTEM "chrome://dwhelper/locale/dwhelper.dtd" >
  6.  
  7. <bindings xmlns="http://www.mozilla.org/xbl"
  8.     xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
  9.     xmlns:html="http://www.w3.org/1999/xhtml"
  10.     xmlns:xbl="http://www.mozilla.org/xbl">
  11.  
  12.     <binding id="widget">
  13.  
  14.         <xbl:content xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  15.             <children style="display: none;"/>
  16.         </xbl:content>
  17.  
  18.         <implementation>
  19.  
  20.             <constructor>
  21.                 <![CDATA[
  22. //dump("Widget\n");
  23. this.util=Components.classes["@downloadhelper.net/util-service;1"]
  24.     .getService(Components.interfaces.dhIUtilService);
  25. this.NS="http://downloadhelper.net/1.0#";
  26. this.prefObservers={};
  27. this.mapAnonid();
  28. var prefService=Components.classes["@mozilla.org/preferences-service;1"]
  29.     .getService(Components.interfaces.nsIPrefService);
  30. this.pref=prefService.getBranch("semioscape.");
  31. this.mediaListMgr=Components.classes["@downloadhelper.net/media-list-manager"]
  32.     .getService(Components.interfaces.dhIMediaListMgr);
  33. this.convertMgr=Components.classes["@downloadhelper.net/convert-manager-component"]
  34.     .getService(Components.interfaces.dhIConvertMgr);
  35. //dump("Calling handleXBLPersist\n"); 
  36. try {
  37.     this.handleXBLPersist();
  38.     //dump("Called handleXBLPersist\n");
  39. } catch(e) {
  40.     dump("!!! [Widget] constructor: calling handleXBLPersist:"+e+"\n");
  41. }
  42.                 ]]>
  43.             </constructor>
  44.  
  45.             <destructor>
  46.                 <![CDATA[
  47.                 ]]>
  48.             </destructor>
  49.  
  50.             <method name="mapAnonid">
  51.                 <body>
  52.                 <![CDATA[
  53. var nodes=document.getAnonymousNodes(this);
  54. for(var i=0;i<nodes.length;i++) {
  55.     var node=nodes[i];
  56.     this.mapAnonidRec(node);
  57. }
  58.                 ]]>
  59.                 </body>
  60.             </method>
  61.  
  62.             <method name="mapAnonidRec">
  63.                 <parameter name="node"/>
  64.                 <body>
  65.                 <![CDATA[
  66. if(node.nodeType==Node.ELEMENT_NODE) {
  67.     var anonid=node.getAttribute("anonid");
  68.     if(anonid!=null && anonid.length>0) {
  69.         //this.debugln("[widget] mapAnonidRec: map "+anonid);
  70.         this[anonid]=node;
  71.         node.parentXBL=this;
  72.         //this.debugln("[widget] mapAnonidRec: element "+node.tagName+" has parentXBL "+node.parentXBL);        
  73.     }
  74.     node=node.firstChild;
  75.     while(node!=null) {
  76.         this.mapAnonidRec(node);
  77.         node=node.nextSibling;
  78.     }
  79. }
  80.                 ]]>
  81.                 </body>
  82.             </method>
  83.  
  84.             <method name="getAnonNodes">
  85.                 <parameter name="attr"/>
  86.                 <body>
  87.                 <![CDATA[
  88. var aNodes=[];
  89. var nodes=document.getAnonymousNodes(this);
  90. for(var i=0;i<nodes.length;i++) {
  91.     var node=nodes[i];
  92.     this.getAnonNodesRec(node, attr, aNodes);
  93. }
  94. return aNodes;
  95.                 ]]>
  96.                 </body>
  97.             </method>
  98.  
  99.             <method name="getAnonNodesRec">
  100.                 <parameter name="node"/>
  101.                 <parameter name="attr"/>
  102.                 <parameter name="aNodes"/>
  103.                 <body>
  104.                 <![CDATA[
  105. if(node.nodeType==Node.ELEMENT_NODE) {
  106.     var aValue=node.getAttribute(attr);
  107.     if(aValue!=null && aValue.length>0) {
  108.         aNodes.push(node);
  109.     }
  110.     node=node.firstChild;
  111.     while(node!=null) {
  112.         this.getAnonNodesRec(node,attr,aNodes);
  113.         node=node.nextSibling;
  114.     }
  115. }
  116.                 ]]>
  117.                 </body>
  118.             </method>
  119.  
  120.             <method name="fireEvent">
  121.                 <parameter name="evType"/>
  122.                 <body>
  123.                 <![CDATA[
  124. var evt = document.createEvent("Events");
  125. evt.initEvent(evType, true, true);
  126. var sendEvent=function(_this,evt) {
  127.     _this.dispatchEvent(evt);
  128. }
  129. setTimeout(sendEvent,0,this,evt);
  130.                 ]]>
  131.                 </body>
  132.             </method>
  133.  
  134.             <method name="sendEvent">
  135.                 <parameter name="evType"/>
  136.                 <body>
  137.                 <![CDATA[
  138. var evt = document.createEvent("Events");
  139. evt.initEvent(evType, true, true);
  140. this.dispatchEvent(evt);
  141.                 ]]>
  142.                 </body>
  143.             </method>
  144.  
  145.             <method name="getLocalStore">
  146.                 <body>
  147.                 <![CDATA[
  148. if(this.localstore==null) {
  149.     this.localstore=Components.classes["@mozilla.org/rdf/datasource;1?name=local-store"].
  150.            getService(Components.interfaces.nsIRDFDataSource);
  151. }
  152. return this.localstore;
  153.                 ]]>
  154.                 </body>
  155.             </method>
  156.  
  157.             <method name="handleXBLPersist">
  158.                 <body>
  159.                 <![CDATA[
  160. //dump("handleXBLPersist "+this.tagName+"\n");
  161. var pNodes=this.getAnonNodes("xbl-persist");
  162. //dump("handleXBLPersist: got "+pNodes.length+" nodes\n");
  163. var prefix="";
  164. if(this.hasAttribute("xbl-persist-prefix"))
  165.     prefix=this.getAttribute("xbl-persist-prefix");
  166.  
  167. for(var i=0;i<pNodes.length;i++) {
  168.     var node=pNodes[i];
  169.     var value=node.getAttribute("xbl-persist");
  170.     var parts=/^(.*?):(.*)$/.exec(value);
  171.     if(parts!=null && parts.length==3) {
  172.         var name=prefix+parts[1];
  173.         var attrs=parts[2].split(",");
  174.         for(var j=0;j<attrs.length;j++) {
  175.             var lsRes=this.NS+"xbl-persist-node-"+name;
  176.             var lsProp=this.NS+"xbl-persist-attribute-"+attrs[j];
  177.             var value=this.util.getPropertyValueSS(this.getLocalStore(),
  178.                 lsRes,lsProp);
  179.             //dump("Loading "+lsRes+" "+lsProp+" "+value+"\n");
  180.             if(value!=null)
  181.                 node.setAttribute(attrs[j],value);
  182.         }
  183.     }
  184. }
  185.                 ]]>
  186.                 </body>
  187.             </method>
  188.  
  189.  
  190.         </implementation>
  191.     
  192.         <handlers>
  193.             <handler event="DOMAttrModified">
  194.                 <![CDATA[
  195. //dump("DOMAttrModified "+this.tagName+": "+event.originalTarget.getAttribute("anonid")+" attribute "+event.attrName+" "+event.prevValue+"=>"+event.newValue+"\n");
  196.  
  197. if(this.doMonitorXBLPersist!=true)
  198.     return;
  199.  
  200. var node=event.originalTarget;
  201. if(!node.hasAttribute("xbl-persist")) 
  202.     return;
  203.  
  204. var prefix="";
  205. if(this.hasAttribute("xbl-persist-prefix"))
  206.     prefix=this.getAttribute("xbl-persist-prefix");
  207.  
  208. var value=node.getAttribute("xbl-persist");
  209. var parts=/^(.*?):(.*)$/.exec(value);
  210. if(parts!=null && parts.length==3) {
  211.     var name=prefix+parts[1];
  212.     var attrs=parts[2].split(",");
  213.     for(var j=0;j<attrs.length;j++) {
  214.         if(attrs[j]==event.attrName) {
  215.             var lsRes=this.NS+"xbl-persist-node-"+name;
  216.             var lsProp=this.NS+"xbl-persist-attribute-"+attrs[j];
  217.             //dump("Saving "+lsRes+" "+lsProp+" "+event.newValue+"\n");
  218.             this.util.setPropertyValueSS(this.getLocalStore(),
  219.                 lsRes,lsProp,event.newValue);
  220.         }
  221.     }
  222. }
  223.  
  224.  
  225.  
  226.                 ]]>
  227.             </handler>
  228.         </handlers>
  229.                  
  230.     </binding>
  231.  
  232. <!-- ******************************************************************************************** -->
  233.  
  234.     <binding id="ExtList" extends="widgets.xml#widget">
  235.  
  236.         <xbl:content xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  237.             <vbox flex="1">
  238.                 <listbox anonid="listbox" flex="1" onselect="this.parentNode.parentNode.select()"
  239.                     seltype="multiple" style="height: 60px;"/>
  240.                 <hbox>
  241.                     <textbox anonid="textbox" 
  242.                         onkeyup="this.parentNode.parentNode.parentNode.keypress()"
  243.                         />
  244.                     <button anonid="add-button" label="&button.add;" oncommand="this.parentNode.parentNode.parentNode.add()" disabled="true"/>
  245.                 </hbox>
  246.                 <hbox>
  247.                     <button label="&button.default;" oncommand="this.parentNode.parentNode.parentNode.setDefault()"/>
  248.                     <button anonid="remove-button" label="&button.remove;" disabled="true" oncommand="this.parentNode.parentNode.parentNode.remove()"/>
  249.                 </hbox>
  250.             </vbox>
  251.             <children style="display: none;"/>
  252.         </xbl:content>
  253.  
  254.         <implementation>
  255.  
  256.             <constructor>
  257.                 <![CDATA[
  258. this.listbox=document.getAnonymousElementByAttribute(this,"anonid","listbox");
  259. this.textbox=document.getAnonymousElementByAttribute(this,"anonid","textbox");
  260. this.removeButton=document.getAnonymousElementByAttribute(this,"anonid","remove-button");
  261. this.addButton=document.getAnonymousElementByAttribute(this,"anonid","add-button");
  262.                 ]]>
  263.             </constructor>
  264.  
  265.             <method name="add">
  266.                 <body>
  267.                 <![CDATA[
  268. var ext=this.textbox.value;
  269. if(ext=="")
  270.     return;
  271. this.addExt(ext);
  272.                 ]]>
  273.                 </body>
  274.             </method>
  275.  
  276.             <method name="addExt">
  277.                 <parameter name="ext"/>
  278.                 <body>
  279.                 <![CDATA[
  280. if(ext==null|| ext=="")
  281.     return;
  282. var listitem=document.createElement("listitem");
  283. listitem.setAttribute("label",ext);
  284. this.listbox.appendChild(listitem);
  285.                 ]]>
  286.                 </body>
  287.             </method>
  288.  
  289.             <method name="select">
  290.                 <body>
  291.                 <![CDATA[
  292. if(this.listbox.selectedItems.length==0) {
  293.     this.removeButton.setAttribute("disabled","true");
  294. } else {
  295.     this.removeButton.setAttribute("disabled","false");
  296. }
  297.                 ]]>
  298.                 </body>
  299.             </method>
  300.  
  301.             <method name="remove">
  302.                 <body>
  303.                 <![CDATA[
  304. if(this.listbox.selectedItems.length==0)
  305.     return;
  306. while(this.listbox.selectedItems.length>0) {
  307.     var tbd=this.listbox.selectedItems[0];
  308.     var item=this.listbox.firstChild;
  309.     while(item!=null) {
  310.         if(item==tbd) {
  311.             this.listbox.removeChild(item);
  312.             break;
  313.         }
  314.         item=item.nextSibling;
  315.     }
  316. }
  317. this.fireEvent("change");
  318.                 ]]>
  319.                 </body>
  320.             </method>
  321.  
  322.             <method name="keypress">
  323.                 <body>
  324.                 <![CDATA[
  325. var text=this.textbox.value;
  326. if(text.length==0 || this.hasExt(text))
  327.     this.addButton.setAttribute("disabled","true");
  328. else
  329.     this.addButton.setAttribute("disabled","false");
  330.                 ]]>
  331.                 </body>
  332.             </method>
  333.  
  334.             <method name="hasExt">
  335.                 <parameter name="ext"/>
  336.                 <body>
  337.                 <![CDATA[
  338. var item=this.listbox.firstChild;
  339. while(item!=null) {
  340.     if(item.getAttribute("label")==ext)
  341.         return true;
  342.     item=item.nextSibling;
  343. }
  344.                 ]]>
  345.                 </body>
  346.             </method>
  347.  
  348.             <method name="clear">
  349.                 <body>
  350.                 <![CDATA[
  351. while(this.listbox.firstChild) 
  352.     this.listbox.removeChild(this.listbox.firstChild);
  353.                 ]]>
  354.                 </body>
  355.             </method>
  356.  
  357.             <method name="setDefault">
  358.                 <body>
  359.                 <![CDATA[
  360. if(this.hasAttribute("defaults")) {
  361.     var def=this.getAttribute("defaults");
  362.     this.setData(def);
  363. } else if(this.hasAttribute("preference")) {
  364.     var prefName=document.getElementById(this.getAttribute("preference")).getAttribute("name");
  365.     var prefService=Components.classes["@mozilla.org/preferences-service;1"]
  366.                                        .getService(Components.interfaces.nsIPrefBranch);
  367.     prefService.clearUserPref(prefName);
  368.     this.setData(prefService.getCharPref(prefName));
  369. }
  370.                 ]]>
  371.                 </body>
  372.             </method>
  373.  
  374.             <method name="setData">
  375.                 <parameter name="def"/>
  376.                 <body>
  377.                 <![CDATA[
  378. this.clear();
  379. var exts=def.split("|");
  380. for(var i=0;i<exts.length;i++)
  381.     this.addExt(exts[i]);
  382. this.fireEvent("change");
  383.                 ]]>
  384.                 </body>
  385.             </method>
  386.  
  387.             <method name="getData">
  388.                 <body>
  389.                 <![CDATA[
  390. var exts=[];
  391. var item=this.listbox.firstChild;
  392. while(item!=null) {
  393.     exts.push(item.getAttribute("label"));
  394.     item=item.nextSibling;
  395. }
  396. return exts.join("|");
  397.                 ]]>
  398.                 </body>
  399.             </method>
  400.  
  401.             <property name="value">  
  402.                 <setter>
  403.                 <![CDATA[
  404. this.setData(val);
  405.                 ]]> 
  406.                 </setter>
  407.                 <getter>
  408.                 <![CDATA[
  409. var data=this.getData();
  410. return data;
  411.                 ]]> 
  412.                 </getter>
  413.             </property>
  414.  
  415.  
  416.  
  417.         </implementation>
  418.     </binding>
  419.     
  420.     
  421.     <binding id="BlackList" extends="widgets.xml#ExtList">
  422.  
  423.         <implementation>
  424.  
  425.             <constructor>
  426.                 <![CDATA[
  427.                 ]]>
  428.             </constructor>
  429.     
  430.             <method name="add">
  431.                 <body>
  432.                 <![CDATA[
  433. var ext=this.textbox.value;
  434. if(ext=="")
  435.     return;
  436. if(!/^([0-9a-zA-Z\-_]+\.)+[0-9a-zA-Z\-_]+$/.test(ext)) {
  437.     this.util.alertError(this.util.getText("blacklist.error.invalid-hostname"));
  438.     return;
  439. }
  440. this.addExt(ext);
  441.                 ]]>
  442.                 </body>
  443.             </method>
  444.  
  445.         </implementation>
  446.     </binding>
  447.     
  448.     <binding id="TextboxEnabled" extends="widgets.xml#widget">
  449.  
  450.         <xbl:content xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  451.             <hbox>
  452.                 <vbox>
  453.                     <spacer flex="1"/>
  454.                     <html:input type="checkbox" anonid="xEnable" onchange="this.parentNode.parentNode.parentNode.changedEnabled()"/>
  455.                     <spacer flex="1"/>
  456.                 </vbox>    
  457.                 <textbox anonid="xTextbox" flex="1" style="visibility:hidden;"/>
  458.             </hbox>
  459.             <children style="display: none;"/>
  460.         </xbl:content>
  461.  
  462.         <implementation>
  463.  
  464.             <constructor>
  465.                 <![CDATA[
  466.                 ]]>
  467.             </constructor>
  468.  
  469.             <property name="value">  
  470.                 <setter>
  471.                 <![CDATA[
  472. if(val==null || val.length==0) {
  473.     this.xEnable.checked=false;
  474.     this.xTextbox.value="";
  475.     this.xTextbox.style.visibility="hidden"; 
  476. } else {
  477.     this.xEnable.checked=true;
  478.     this.xTextbox.value=val;
  479.     this.xTextbox.style.visibility="visible"; 
  480. }
  481.                 ]]> 
  482.                 </setter>
  483.                 <getter>
  484.                 <![CDATA[
  485. if(this.xEnable.checked)
  486.     return this.xTextbox.value;
  487. else
  488.     return "";
  489.                 ]]> 
  490.                 </getter>
  491.             </property>
  492.  
  493.             <method name="changedEnabled">
  494.                 <body>
  495.                 <![CDATA[
  496. if(this.xEnable.checked) {
  497.     this.xTextbox.style.visibility="visible";
  498.     if(this.hasAttribute("defvalue"))
  499.         this.xTextbox.value=this.getAttribute("defvalue");
  500. } else {
  501.     this.xTextbox.style.visibility="hidden";
  502.                 ]]>
  503.                 </body>
  504.             </method>
  505.  
  506.  
  507.         </implementation>
  508.         
  509.     </binding>
  510.  
  511.     <binding id="KeyEditor" extends="widgets.xml#widget">
  512.  
  513.         <xbl:content xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  514.             <hbox>
  515.                 <menulist anonid="xModifier">
  516.                     <menupopup>
  517.                         <menuitem value="1" label="CTRL"/>
  518.                         <menuitem value="3" label="SHIFT+CTRL"/>
  519.                         <menuitem value="6" label="SHIFT+ALT"/>
  520.                         <menuitem value="5" label="CTRL+ALT"/>
  521.                         <menuitem value="7" label="CTRL+SHIFT+ALT"/>
  522.                     </menupopup>
  523.                 </menulist>
  524.                 <menulist anonid="xKey">
  525.                     <menupopup>
  526.                         <menuitem value="VK_CANCEL" label="CANCEL"/>
  527.                         <menuitem value="VK_BACK" label="BACK"/>
  528.                         <menuitem value="VK_TAB" label="TAB"/>
  529.                         <menuitem value="VK_CLEAR" label="CLEAR"/>
  530.                         <menuitem value="VK_RETURN" label="RETURN"/>
  531.                         <menuitem value="VK_ENTER" label="ENTER"/>
  532.                         <menuitem value="VK_PAUSE" label="PAUSE"/>
  533.                         <menuitem value="VK_ESCAPE" label="ESCAPE"/>
  534.                         <menuitem value="VK_SPACE" label="SPACE"/>
  535.                         <menuitem value="VK_PAGE_UP" label="PAGE_UP"/>
  536.                         <menuitem value="VK_PAGE_DOWN" label="PAGE_DOWN"/>
  537.                         <menuitem value="VK_END" label="END"/>
  538.                         <menuitem value="VK_HOME" label="HOME"/>
  539.                         <menuitem value="VK_LEFT" label="LEFT"/>
  540.                         <menuitem value="VK_UP" label="UP"/>
  541.                         <menuitem value="VK_RIGHT" label="RIGHT"/>
  542.                         <menuitem value="VK_DOWN" label="DOWN"/>
  543.                         <menuitem value="VK_PRINTSCREEN" label="PRINTSCREEN"/>
  544.                         <menuitem value="VK_INSERT" label="INSERT"/>
  545.                         <menuitem value="VK_DELETE" label="DELETE"/>
  546.                         <menuitem value="VK_0" label="0"/>
  547.                         <menuitem value="VK_1" label="1"/>
  548.                         <menuitem value="VK_2" label="2"/>
  549.                         <menuitem value="VK_3" label="3"/>
  550.                         <menuitem value="VK_4" label="4"/>
  551.                         <menuitem value="VK_5" label="5"/>
  552.                         <menuitem value="VK_6" label="6"/>
  553.                         <menuitem value="VK_7" label="7"/>
  554.                         <menuitem value="VK_8" label="8"/>
  555.                         <menuitem value="VK_9" label="9"/>
  556.                         <menuitem value="VK_SEMICOLON" label="SEMICOLON"/>
  557.                         <menuitem value="VK_EQUALS" label="EQUALS"/>
  558.                         <menuitem value="VK_A" label="A"/>
  559.                         <menuitem value="VK_B" label="B"/>
  560.                         <menuitem value="VK_C" label="C"/>
  561.                         <menuitem value="VK_D" label="D"/>
  562.                         <menuitem value="VK_E" label="E"/>
  563.                         <menuitem value="VK_F" label="F"/>
  564.                         <menuitem value="VK_G" label="G"/>
  565.                         <menuitem value="VK_H" label="H"/>
  566.                         <menuitem value="VK_I" label="I"/>
  567.                         <menuitem value="VK_J" label="J"/>
  568.                         <menuitem value="VK_K" label="K"/>
  569.                         <menuitem value="VK_L" label="L"/>
  570.                         <menuitem value="VK_M" label="M"/>
  571.                         <menuitem value="VK_N" label="N"/>
  572.                         <menuitem value="VK_O" label="O"/>
  573.                         <menuitem value="VK_P" label="P"/>
  574.                         <menuitem value="VK_Q" label="Q"/>
  575.                         <menuitem value="VK_R" label="R"/>
  576.                         <menuitem value="VK_S" label="S"/>
  577.                         <menuitem value="VK_T" label="T"/>
  578.                         <menuitem value="VK_U" label="U"/>
  579.                         <menuitem value="VK_V" label="V"/>
  580.                         <menuitem value="VK_W" label="W"/>
  581.                         <menuitem value="VK_X" label="X"/>
  582.                         <menuitem value="VK_Y" label="Y"/>
  583.                         <menuitem value="VK_Z" label="Z"/>
  584.                         <menuitem value="VK_NUMPAD0" label="NUMPAD0"/>
  585.                         <menuitem value="VK_NUMPAD1" label="NUMPAD1"/>
  586.                         <menuitem value="VK_NUMPAD2" label="NUMPAD2"/>
  587.                         <menuitem value="VK_NUMPAD3" label="NUMPAD3"/>
  588.                         <menuitem value="VK_NUMPAD4" label="NUMPAD4"/>
  589.                         <menuitem value="VK_NUMPAD5" label="NUMPAD5"/>
  590.                         <menuitem value="VK_NUMPAD6" label="NUMPAD6"/>
  591.                         <menuitem value="VK_NUMPAD7" label="NUMPAD7"/>
  592.                         <menuitem value="VK_NUMPAD8" label="NUMPAD8"/>
  593.                         <menuitem value="VK_NUMPAD9" label="NUMPAD9"/>
  594.                         <menuitem value="VK_MULTIPLY" label="MULTIPLY"/>
  595.                         <menuitem value="VK_ADD" label="ADD"/>
  596.                         <menuitem value="VK_SEPARATOR" label="SEPARATOR"/>
  597.                         <menuitem value="VK_SUBTRACT" label="SUBTRACT"/>
  598.                         <menuitem value="VK_DECIMAL" label="DECIMAL"/>
  599.                         <menuitem value="VK_DIVIDE" label="DIVIDE"/>
  600.                         <menuitem value="VK_F1" label="F1"/>
  601.                         <menuitem value="VK_F2" label="F2"/>
  602.                         <menuitem value="VK_F3" label="F3"/>
  603.                         <menuitem value="VK_F4" label="F4"/>
  604.                         <menuitem value="VK_F5" label="F5"/>
  605.                         <menuitem value="VK_F6" label="F6"/>
  606.                         <menuitem value="VK_F7" label="F7"/>
  607.                         <menuitem value="VK_F8" label="F8"/>
  608.                         <menuitem value="VK_F9" label="F9"/>
  609.                         <menuitem value="VK_F10" label="F10"/>
  610.                         <menuitem value="VK_F11" label="F11"/>
  611.                         <menuitem value="VK_F12" label="F12"/>
  612.                         <menuitem value="VK_F13" label="F13"/>
  613.                         <menuitem value="VK_F14" label="F14"/>
  614.                         <menuitem value="VK_F15" label="F15"/>
  615.                         <menuitem value="VK_F16" label="F16"/>
  616.                         <menuitem value="VK_F17" label="F17"/>
  617.                         <menuitem value="VK_F18" label="F18"/>
  618.                         <menuitem value="VK_F19" label="F19"/>
  619.                         <menuitem value="VK_F20" label="F20"/>
  620.                         <menuitem value="VK_F21" label="F21"/>
  621.                         <menuitem value="VK_F22" label="F22"/>
  622.                         <menuitem value="VK_F23" label="F23"/>
  623.                         <menuitem value="VK_F24" label="F24"/>
  624.                         <menuitem value="VK_NUM_LOCK" label="NUM_LOCK"/>
  625.                         <menuitem value="VK_SCROLL_LOCK" label="SCROLL_LOCK"/>
  626.                         <menuitem value="VK_COMMA" label="COMMA"/>
  627.                         <menuitem value="VK_PERIOD" label="PERIOD"/>
  628.                         <menuitem value="VK_SLASH" label="SLASH"/>
  629.                         <menuitem value="VK_BACK_QUOTE" label="BACK_QUOTE"/>
  630.                         <menuitem value="VK_OPEN_BRACKET" label="OPEN_BRACKET"/>
  631.                         <menuitem value="VK_BACK_SLASH" label="BACK_SLASH"/>
  632.                         <menuitem value="VK_CLOSE_BRACKET" label="CLOSE_BRACKET"/>
  633.                         <menuitem value="VK_QUOTE" label="QUOTE"/>
  634.                         <menuitem value="VK_HELP" label="HELP"/>
  635.                     </menupopup>
  636.                 </menulist>
  637.             </hbox>
  638.             <children style="display: none;"/>
  639.         </xbl:content>
  640.  
  641.         <implementation>
  642.  
  643.             <constructor>
  644.                 <![CDATA[
  645. this.updateKeyLocales();
  646.                 ]]>
  647.             </constructor>
  648.             
  649.             <method name="updateKeyLocales">
  650.                 <body>
  651.                 <![CDATA[
  652. var menuitem=this.xModifier.firstChild.firstChild;
  653. while(menuitem!=null) {
  654.     var keys=[];
  655.     for(var i=0;i<3;i++) {
  656.         if(menuitem.getAttribute("value") & (1<<i))
  657.             keys.push(this.util.getText("processor.quickkey.key"+i));
  658.     }
  659.     menuitem.setAttribute("label",keys.join("+"));
  660.     menuitem=menuitem.nextSibling;
  661. }
  662.                 ]]>
  663.                 </body>
  664.             </method>
  665.  
  666.  
  667.             <property name="value">
  668.                 <getter>
  669.                 <![CDATA[
  670. return this.xModifier.value+";"+this.xKey.value;
  671.                 ]]>
  672.                 </getter>
  673.                 <setter>
  674.                 <![CDATA[
  675. var keyParts=val.split(";",2);
  676. this.key=keyParts[1];
  677. if(!/^VK_/.test(this.key))
  678.     this.key="VK_"+this.key;
  679. this.xKey.value=this.key;
  680. this.modifier=keyParts[0];
  681. this.xModifier.value=this.modifier;
  682.                 ]]>
  683.                 </setter>
  684.             </property>
  685.  
  686.         </implementation>
  687.         
  688.     </binding>
  689.     
  690.     <binding id="ProcessorMenulist" extends="widgets.xml#widget">
  691.  
  692.         <xbl:content xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  693.             <menulist anonid="xProcessors">
  694.                 <menupopup anonid="xProcPopup"/>
  695.             </menulist>
  696.             <children style="display: none;"/>
  697.         </xbl:content>
  698.  
  699.         <implementation>
  700.  
  701.             <constructor>
  702.                 <![CDATA[
  703. this.core=Components.classes["@downloadhelper.net/core;1"].
  704.     getService(Components.interfaces.dhICore);
  705. var processors=this.core.getProcessors();
  706. var i=processors.enumerate();
  707. while(i.hasMoreElements()) {
  708.     var processor=i.getNext().QueryInterface(Components.interfaces.dhIProcessor);
  709.     var menuitem=document.createElement("menuitem");
  710.     menuitem.setAttribute("label",processor.title);
  711.     menuitem.setAttribute("value",processor.name);
  712.     this.xProcPopup.appendChild(menuitem);
  713. }
  714.                 ]]>
  715.             </constructor>
  716.  
  717.             <property name="value">
  718.                 <getter>
  719.                 <![CDATA[
  720. return this.xProcessors.value;
  721.                 ]]>
  722.                 </getter>
  723.                 <setter>
  724.                 <![CDATA[
  725. this.xProcessors.value=val;
  726.                 ]]>
  727.                 </setter>
  728.             </property>
  729.  
  730.         </implementation>
  731.  
  732.     </binding>
  733.  
  734.     <binding id="DHPassword" extends="#widget">
  735.  
  736.         <xbl:content xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  737.             <textbox anonid="xPassword" type="password"/>
  738.             <children style="display: none;"/>
  739.         </xbl:content>
  740.  
  741.         <implementation>
  742.  
  743.             <constructor>
  744.                 <![CDATA[
  745. this.mValueSet=false;
  746.                 ]]>
  747.             </constructor>
  748.  
  749.             <destructor>
  750.                 <![CDATA[
  751.                 ]]>
  752.             </destructor>
  753.  
  754.             <property name="value">
  755.                 <getter>
  756.                 <![CDATA[
  757. return this.xPassword.value;
  758.                 ]]>
  759.                 </getter>
  760.                 <setter>
  761.                 <![CDATA[
  762. this.xPassword.value=val;
  763. this.mValueSet=true;
  764.                 ]]>
  765.                 </setter>
  766.             </property>
  767.             
  768.             <property name="valueSet">
  769.                 <getter>
  770.                 <![CDATA[
  771. return this.mValueSet;
  772.                 ]]>
  773.                 </getter>
  774.             </property>
  775.             
  776.             <property name="disabled">
  777.                 <getter>
  778.                 <![CDATA[
  779. return this.xPassword.disabled;
  780.                 ]]>
  781.                 </getter>
  782.                 <setter>
  783.                 <![CDATA[
  784. this.xPassword.disabled=val;
  785.                 ]]>
  786.                 </setter>
  787.             </property>
  788.  
  789.             
  790.         </implementation>
  791.  
  792.     </binding>
  793.  
  794.  
  795. </bindings>
  796.